<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>date()</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../date.js" type="text/javascript"></script>
<style type="text/css">
body {
  font-family: sans-serif;
}

td, th {
  padding: 3px 10px;
}

td {
  font-family: monospace;
}

th {
  text-align: left;
}
</style>
</head>
<body>
<h1>date()</h1>

<h2>JavaScript adaption from <a href="http://php.net/date">PHP's date() function</a></h2>
<p>Rewritten from dateFormat() by Steven Levithan (<a href="http://stevenlevithan.com/assets/misc/date.format.js">http://stevenlevithan.com/assets/misc/date.format.js</a>)</p>
<p>Missing some formats (replaced by ?)</p>

<h2>Example output</h2>
<table>
    <thead>
      <tr><th>Format</th><th>Result</th></tr>
    </thead>
    <tbody id="output">
      <tr><td colspan="2">This text should have been replaced by JavaScript. Please check your browser settings to make sure JavaScript is enabled, or if there was an error, <a href="http://code.google.com/p/blixt/issues/entry">report it</a>.</td></tr>
    </tbody>
</table>

<script type="text/javascript">
var formats = [
  'Y-m-d H:i:s',
  'l dS \\of F Y h:i:s A',
  'F j, Y, g:i a',
  'm.d.y',
  'j, n, Y',
  'Ymd',
  '\\i\\t \\i\\s \\t\\h\\e jS \\d\\a\\y.',
  'l \\t\\h\\e jS',
  'D M j G:i:s T Y'
];

var output = document.getElementById('output');
var example = function () {
  output.innerHTML = '';
  for (var i in formats) {
    output.innerHTML += '<tr><td>' + formats[i] + '</td><td>' + date(formats[i]) + '</td></tr>';
  }
};

example();
setInterval(example, 1000);
</script>
</body>
</html>
